{##}
{#{% extends 'base.html' %}#}
{#{% block content %}#}

{% load static %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>博客首页</title>
    <link href="{% static 'bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
    <link href="{% static 'css/cl-css.css' %}" rel="stylesheet">
    <link href="{% static 'font-awesome/css/font-awesome.min.css' %}" rel="stylesheet">
    <link rel="stylesheet" href="{% static 'highlight/styles/railscasts.css' %}">
</head>
<body>

<div class="cl-header container-fluid" id="app">
    <div class="header-content container">
        <nav class="navbar navbar-expand-lg navbar-light">
            <a class="navbar-brand" href="{% url 'home:index' %}">
                <img src="{% static 'img/img_2.png' %}" width="144" height="72" alt="">
            </a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
                    aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse justify-content-end" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item active">
                        <a class="nav-link" href="{% url 'home:index' %}">首页 <span class="sr-only">(current)</span></a>
                    </li>
                    {% for cat in categories %}
                        {% if cat.id == category.id %}
                            <li class="nav-item active">
                                <a class="nav-link mr-2" href="/?cat_id={{ cat.id }}">{{ cat.title }}</a>
                            </li>
                        {% else %}
                            <li class="nav-item">
                                <a class="nav-link mr-2" href="/?cat_id={{ cat.id }}">{{ cat.title }}</a>
                            </li>
                        {% endif %}
                    {% endfor %}
                    <!-- 如果用户已经登录，则显示用户名下拉框 -->
                    <li class="nav-item dropdown" v-if="is_login">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" @click="show_menu_click">{{ username }}</a>
                        <div class="dropdown-menu" aria-labelledby="navbarDropdown" style="display: block"
                             v-show="show_menu">
                            <a class="dropdown-item" href="{% url 'users:writeblog' %}">写文章</a>
                            <a class="dropdown-item" href='{% url 'users:usercenter' %}'>个人信息</a>
                            <a class="dropdown-item" href='{% url 'users:logout' %}'>退出登录</a>
                        </div>
                    </li>
                    <!-- 如果用户未登录，则显示登录按钮 -->
                    <li class="nav-item" v-else>
                        <a class="nav-link" href="{% url 'users:login' %}">登录</a>
                    </li>
                </ul>
            </div>
        </nav>
    </div>
</div>

<div class="cl-cantainer container">
    <div class="row">
        <div class="col-md-9 cl-left">

            <div class="recommend-index">
                <div class="recommend-top">

                    <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
                        <ol class="carousel-indicators">
                            <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
                            <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
                            <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
                        </ol>
                        <div class="carousel-inner">
                            <div class="carousel-item active">
                                <img class="d-block w-100" src="{% static 'temporary-img/img.png' %}"
                                     alt="First slide">
                            </div>
                            <div class="carousel-item">
                                <img class="d-block w-100" src="{% static 'temporary-img/img_1.png' %}"
                                     alt="Second slide">
                            </div>
                            <div class="carousel-item">
                                <img class="d-block w-100" src="{% static 'temporary-img/img_2.png' %}"
                                     alt="Third slide">
                            </div>
                        </div>
                        <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button"
                           data-slide="prev">
                            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                            <span class="sr-only">Previous</span>
                        </a>
                        <a class="carousel-control-next" href="#carouselExampleIndicators" role="button"
                           data-slide="next">
                            <span class="carousel-control-next-icon" aria-hidden="true"></span>
                            <span class="sr-only">Next</span>
                        </a>
                    </div>


                </div>
                <div class="recommend-bottom">
                    <div class="recommend-item">
                        <a href="{% static '/detail.html' %}"><img
                                src="{% static 'temporary-img/img_3.png' %}" class="img-fluid" alt=""></a>
                    </div>
                    <div class="recommend-item">
                        <a href="{% static '/detail.html' %}"><img
                                src="{% static 'temporary-img/img_4.png' %}" class="img-fluid" alt=""></a>
                    </div>
                </div>

            </div>


            <div class="container">
                <!-- 列表循环 -->
                {% for article in articles %}
                    <div class="row mt-2">
                        <!-- 文章内容 -->
                        <!-- 标题图 -->
                        <div class="col-3">
                            <img src="{{ article.avatar.url }}" alt="avatar"
                                 style="max-width:100%; border-radius: 20px">
                        </div>
                        <div class="col">
                            <!-- 栏目 -->
                            <a role="button" class="btn btn-sm mb-2 btn-warning">{{ article.category.title }}</a>
                            <!-- 标签 -->
                            <span>
                        <a class="badge badge-secondary">{{ article.tags }}</a>
                </span>
                            <!-- 标题 -->

                            <h4>
                                <b><a href="{% url 'home:detail' %}?id={{ article.id }}"
                                      style="color: black;">{{ article.title }}</a></b>
                            </h4>
                            <!-- 摘要 -->
                            <div>
                                <p style="color: gray;">
                                    {{ article.sumary }}
                                </p>
                            </div>
                            <!-- 注脚 -->
                            <p>
                                <!-- 查看、评论、时间 -->
                                <span><i class="fas fa-eye" style="color: lightskyblue;"></i>{{ article.total_views }}&nbsp;&nbsp;&nbsp;</span>
                                <span><i class="fas fa-comments"
                                         style="color: yellowgreen;"></i>{{ article.comments_count }}&nbsp;&nbsp;&nbsp;</span>
                                <span><i class="fas fa-clock"
                                         style="color: pink;"></i>{{ article.created | date }}</span>
                            </p>
                        </div>
                        <hr style="width: 100%;"/>
                    </div>
                {% endfor %}
                <!-- 页码导航 -->
                <div class="pagenation" style="text-align: center">
                    <div id="pagination" class="page"></div>
                </div>
            </div>


            <nav aria-label="Page navigation example">
                <ul class="pagination justify-content-center">
                    <li class="page-item disabled">
                        <a class="page-link" href="#" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                            <span class="sr-only">Previous</span>
                        </a>
                    </li>
                    <li class="page-item active"><a class="page-link" href="/?cat_id=1&page_index&page_size=2">1</a></li>
                    <li class="page-item"><a class="page-link" href="/?cat_id=2&page_index&page_size=2">2</a></li>
                    <li class="page-item"><a class="page-link" href="/?cat_id=3&page_index&page_size=2">3</a></li>




                    <pageination :total="model.total" :size="model.size" :page="model.page" :changge="pageFn" ></pageination>
                    {{model.page}}




                    <li class="page-item">
                        <a class="page-link" href="#" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                            <span class="sr-only">Next</span>
                        </a>
                    </li>
                </ul>
            </nav>

        </div>

        <div class="recommend-bottom">
            {% for i in indexs %}
                <div class="recommend-item">
                    <a href="{% url 'home:detail' %}"?art_id="{{ i.id }}">
                        <img src="{{ i.avatar.url }}" class="img-fluid" alt="">
                    </a>
                </div>
            {% endfor %}

        </div>


        <div class="col-md-3 cl-right">
            <div class="right-card">

                <div class="right-card-main">
                    <div class="right-card-title">个人微信号</div>
                    <div class="cl-code">
                        <img src="../static/temporary-img/Screenshot_20211012_120246_com.tencent.mm.png" class="img-fluid" alt="">
                        <p>关注作者获取更多模板信息，定时发布干货文章</p>
                    </div>

                </div>
            </div>

            <div class="right-card">

                <div class="right-card-main">
                    <div class="right-card-title">最新文章</div>
                    <div class="right-recommended"><a href="#"><img src="../static/temporary-img/list-right.jpg"
                                                                    class="img-fluid" alt=""></a></div>

                </div>
            </div>

            <div class="right-card">

                <div class="right-card-main">
                    <div class="right-card-title">热门标签</div>
                    <ul class="nav navbar-nav">
                        {% for hot_article in tay %}
                                <li><a href="{% url 'home:detail' %}"
                                       id="{{ hot_article.id }}">{{ hot_article.tags }}</a></li>
                            {% endfor %}
                    </ul>
                </div>
            </div>

        </div>
    </div>

</div>

<div class="container-fluid cl-footer">
    <div class="container">
        <p class="cl-copyright">本设计由简.工作室荣誉出品</p>
        <p class="cl-copyright">copyright @ 2017~2018 简.工作室（www.jeanstudio.cn）</p>
    </div>
</div>
<script src="{% static 'jquery/jquery.min.js' %}"></script>
<script src="{% static 'bootstrap/js/bootstrap.min.js' %}"></script>
<script src="{% static 'highlight/highlight.pack.js' %}"></script>
<script src="{% static 'vue/vue-2.5.16.js' %}"></script>
<script src="{% static 'js/host.js' %}"></script>
<script src="{% static 'vue/axios-0.18.0.min.js' %}"></script>
<script src="{% static 'js/common.js' %}"></script>
<script src="{% static 'js/index.js' %}"></script>


<script type="text/javascript">
    $(function () {
        $('#pagination').pagination({
            currentPage: {{ page_num }},
            totalPage: {{ total_page }},
            callback:function (current) {

                location.href = '/?cat_id={{ category.id }}&page_size={{ page_size }}&page_num='+current;
            }
        })
    });
</script>


<script>hljs.initHighlightingOnLoad();</script>



</body>
</html>
{#{% endblock %}#}